-
Notifications
You must be signed in to change notification settings - Fork 931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add TS definitions #56
Conversation
Codecov Report
@@ Coverage Diff @@
## master #56 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 3 3
Lines 262 262
Branches 63 63
=====================================
Hits 262 262 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is super awesome!
I will merge this and I'm excited to do so with the understanding that I don't personally use typescript and do not plan to maintain TypeScript typings. If these fall out of maintenance and we start getting bug reports on them, I will not expend effort to fix them personally. It's not heartless, it's a matter of time.
So if you're willing to accept that, then I'm happy to merge this PR.
Of course. No expectations on your end. Hopefully the community can help build the TS definitions up alongside Flow in the other PR. |
Awesome! Thanks! If you don't mind, I'd like to wait until the API has settled a bit before we merge TypeScript typings. I don't want you to have to deal with at churn while we figure out what's best 👍 |
Alright! I'm pretty confident the API has solidified, so if you'd like to update this PR that would be awesome 😄 Thanks! |
@kentcdodds Not sure how you want tests for these definitions, but I made a repo here with the example provided in the README. |
For testing, maybe you could look at the glamorous repo. Maybe @luke-john could help guide this? |
Most projects simply test definitions by having a single test file that covers the api. ie.
With glamorous we took things a bit further to try and decrease the chance of regressions. In addition to the above style test we also have a
Given the current size of the typings just having a single test file is probably suitable. It would be good to add a ~ Also if these typings are likely to grow in complexity you may want to consider landing them under a |
Just looking in the typings, it appears there's still a number of In Glamorous we added the following to a
|
index.d.ts
Outdated
} | ||
|
||
type ChildrenFunction = (options: ControllerStateAndHelpers) => React.ReactNode; | ||
interface Downshift extends React.ComponentClass<Downshift.Props> { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having an interface named Downshift
inside a Downshift
namespace which passes the namespaces Props as Downshift.Props
seems like it may cause confusion.
It may be simpler to keep everything at the top level. ie.
interface Props {
...
}
const downshift: React.ComponentClass<Props>
export default downshift
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestions! Will take note and address them :)
I was thinking of creating some test files based on the given examples but since it wouldn't make sense to place it into
Will do.
I left the |
Thanks @luke-john!! @vutran, if you could put the typescript test script in |
@kentcdodds Just a quick update, will try to find some time this week to address the requested chances. (Apologies, trying to recover from outsidelands and work-related stuff in the same time). |
Sounds good. Thank you! |
Okay, I think this is ready for a review. @luke-john
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Things look perfect as far as I can tell! Thank you so much for this!
These are looking good to me @vutran. Great work 👍. It looks like this project is using rollup in a similar way to glamorous so you may hit an issue with typescript not playing nice with the rollup compilation. If so the following addition to the entry file should solve things. paypal/glamorous#104 |
Awesome! We're not on auto-release yet, but I'll get this published soon. Thanks so much @vutran! 🎉 |
I can open a new PR for this if needed. |
Feel free! I leave the TS stuff entirely up to other folks since I don't really use it 🤷♂️ |
Let's try this out! |
Initial draft of TS definitions as I'm planning to expand this more as I begin porting
omnibar
over to use the primitive components offered byreact-autocompletely
.